import re
class CheckRegulary:
    phoneRegex = r'^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[189]))\d{8}$'
    emailRegex = r'^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$'
    chineseRegex = r'^[\u4e00-\u9fff]+$'
    asciiRegex = r'^[\x00-\x7F]+$'
    usernameRegex = r'^[a-zA-Z0-9]{6,32}$'
    passwordRegex = r'^[\x00-\x7F]{6,18}$'
    def check(self, rule, value):
        rule = getattr(self, rule)
        if rule:
            return (bool)(re.compile(rule).match(value) )
        return False
    def checkMultiple(self, ruleExample, value):
        if ruleExample:
            return (bool)(re.compile(ruleExample).match(value) )
        return False
userRule = {
    'username': 'usernameRegex',
    'phone': 'phoneRegex',
    'password': 'passwordRegex',
    'email': 'emailRegex'
    }